package com.lswms.modules.lswms.dao.receipt;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.lswms.common.dao.BaseDao;
import com.lswms.modules.lswms.entity.receipt.ReceiptEntity;

/**
 * 收货
 *
 * @author DX sunlightcs@gmail.com
 * @since 1.0.0 2021-06-13
 */
@Mapper
public interface ReceiptDao extends BaseDao<ReceiptEntity> {

	@Select(value ="select a.* , b.listname typestr , c.listname  statusstr    from lswms_receipt a  left join lswms_codelist b on a.type = b.list and b.code='ReceiptType' "
			+ "			left join lswms_codelist c on a.status = c.list and c.code='receiptstatus'  ${ew.customSqlSegment}")
	IPage<ReceiptEntity> selectPageBySql(IPage<ReceiptEntity> page, @Param(Constants.WRAPPER)QueryWrapper<ReceiptEntity> wrapper);

	@Select("select * from lswms_receipt where receiptkey=#{receiptkey}")
	ReceiptEntity selectReceiptKey(@Param("receiptkey")String receiptkey);
}
